<?php

use Illuminate\Database\Seeder;
use Faker\Factory;
use App\System\Cms\Model\CmsArticle;

class CmsArticleTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run(CmsArticle $article)
    {
        //先清空表
        $article->truncate();
        //实例化faker类
        $faker = Factory::create('zh_CN');//生成中文数据
        //循环
        for ($i = 0; $i < 30; $i++) {
            $article->insert([
                'type'              => mt_rand(0, 2),
                'title'             => $faker->name,
                'convered_image_id' => '0',
                'sender_name'       => '1',
                'summery'           => '摘要.....',
                'content'           => $faker->sentence(),
                'click_count_total' => mt_rand(0, 1000),
                'created_at'        => date('Y-m-d H:i:s', time()),
            ]);
        }
    }
}
